def findMax(matrix): # DO NOT modify this line 
    # TODO: add your code here
    max_value = matrix[0][0]
    max_indexes = []
    for i, row in enumerate(matrix):
        for j, value in enumerate(row):
            if value > max_value:
                max_value = value
                max_indexes = [(i, j)]
            elif value == max_value:
                max_indexes.append((i, j))
    return max_value, max_indexes

# === DO NOT modify the code below === 
def main():
    n = eval(input())
    matrix = []
    for i in range(n):
        row = [ eval(x) for x in input().split() ]
        matrix.append(row)
    max_value, max_indexes = findMax(matrix)
    print(max_value)
    for item in max_indexes:
        print(item[0],item[1],sep=',')
    
if __name__ == "__main__":
    main()
# === DO NOT modify the code above ===
